package ca.ericslandry.shared.event;

import ca.ericslandry.shared.domain.User;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class UserGetEvent extends GwtEvent<UserGetEvent.Handler> {
	public interface Handler extends EventHandler {
		void onUserFound(UserGetEvent event);
	}

	public static Type<UserGetEvent.Handler> TYPE = new Type<UserGetEvent.Handler>();
	private User user;

	public UserGetEvent(User user) {
		this.user = user;
	}

	@Override
	protected void dispatch(UserGetEvent.Handler handler) {
		handler.onUserFound(this);
	}

	@Override
	public Type<UserGetEvent.Handler> getAssociatedType() {
		return TYPE;
	}

	public User getUser() {
		return user;
	}
}
